package com.mes.cloud.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * 记录controller层参数
 *
 * @author: wxm
 * @date: 2019/5/1 17:31
 * @version: 1.0
 */
@Aspect
@Component
public class ParamControllerAop {
    private static Logger LOGGER = LoggerFactory.getLogger(ParamControllerAop.class);

    @Around("execution(* com.mes.cloud.controller.*Controller.*(..))")
    public Object methodParam(ProceedingJoinPoint point) throws Throwable {
        LOGGER.info("method:{}.{}({})",point.getSignature().getDeclaringTypeName(),point.getSignature().getName(),Arrays.toString(point.getArgs()));
        Object result= point.proceed();
        LOGGER.info("method:{}.{} :return :{}",point.getSignature().getDeclaringTypeName(),point.getSignature().getName(),result);
        return result;
    }


}
